package flowlight.action;


import flowlight.entity.Scennic;
import flowlight.service.ScennicService;
import flowlight.utils.JsonVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller("ScennicController")
@RequestMapping("flowlight")
public class ScennicAction {

    @Resource(name = "ScennicService")
    private ScennicService scennicService;

    @ResponseBody
    @RequestMapping("addScennic")
    public JsonVo<String> addScenic(Scennic scennic) {
        JsonVo<String> jsonVo = new JsonVo<String>();
        scennicService.insertSelective(scennic);
        jsonVo.setCode(200);
        jsonVo.setMsg("添加成功");
        return jsonVo;
    }

    @ResponseBody
    @RequestMapping("selectScennic")
    public JsonVo<List<Scennic>>  selectScennic() {
        JsonVo<List<Scennic>> jsonVo = new JsonVo<List<Scennic>>();
        List<Scennic> scennicList = scennicService.selectAllScennic();
        jsonVo.setCode(200);
        jsonVo.setCount(1);
        jsonVo.setMsg("数据返回成功");
        jsonVo.setData(scennicList);
        return jsonVo;
    }





}
